package com.robot.admin.client;

import com.robot.admin.client.impl.OrdersClientImpl;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

/**
 * @author lin
 */
@Component
@FeignClient(value = "robot-orders", fallback = OrdersClientImpl.class)
public interface OrdersClient {
    /**
     * 分页+多条件查询SubOrders
     *
     * @param searchMap 查询条件封装
     * @param page      页码
     * @param size      页大小
     * @return 分页结果
     */
    @RequestMapping(value = "subOrders/third/findSubOrdersBySearch/{page}/{size}", method = RequestMethod.POST, produces = "application/json; charset=utf-8")
    public String thirdFindSubOrdersBySearch(@RequestBody Map searchMap, @PathVariable int page, @PathVariable int size);

    /**
     * 通过id查询SubOrders
     *
     * @param id
     * @return
     */
    @RequestMapping(value = "subOrders/third/findSubOrderById/{id}", method = RequestMethod.GET, produces = "application/json; charset=utf-8")
    public String thirdFindSubOrderById(@PathVariable String id);

    /**
     * 根据memberId查找SubOrders
     *
     * @param memberId
     * @param page
     * @param size
     * @return
     */
    @RequestMapping(value = "subOrders/third/findSubOrdersByMemberId/{memberId}/{page}/{size}", method = RequestMethod.GET, produces = "application/json; charset=utf-8")
    public String thirdFindSubOrdersByMemberId(@PathVariable String memberId, @PathVariable int page, @PathVariable int size);

    /**
     * 根据memberId查找会员累计支付成功的订单数
     *
     * @param memberId
     * @return
     */
    @RequestMapping(value = "subOrders/third/findSubOrderCountByMemberId/{memberId}", method = RequestMethod.GET, produces = "application/json; charset=utf-8")
    public String thirdFindSubOrderCountByMemberId(@PathVariable String memberId);

    /**
     * 根据memberId查找会员累计消费金额
     *
     * @param memberId
     * @return
     */
    @RequestMapping(value = "subOrders/third/findSubOrderPayAmountByMemberId/{memberId}", method = RequestMethod.GET, produces = "application/json; charset=utf-8")
    public String thirdFindSubOrderPayAmountByMemberId(@PathVariable String memberId);

    /**
     * 根据memberId和storeId查找会员累计消费金额
     *
     * @param memberId
     * @param storeId
     * @return
     */
    @RequestMapping(value = "subOrders/third/findSubOrderPayAmountByMemberIdAndStoreId/{memberId}/{storeId}", method = RequestMethod.GET, produces = "application/json; charset=utf-8")
    public String thirdFindSubOrderPayAmountByMemberIdAndStoreId(@PathVariable String memberId, @PathVariable String storeId);

    /**
     * 根据memberID查找会员累计节省金额
     *
     * @param memberId
     * @return
     */
    @RequestMapping(value = "subOrders/third/findSubOrderDiscountAmountByMemberId/{memberId}", method = RequestMethod.GET, produces = "application/json; charset=utf-8")
    public String thirdFindSubOrderDiscountAmountByMemberId(@PathVariable String memberId);

    /**
     * 根据storeId查找本月累计支付成功的订单数
     *
     * @param storeId
     * @return
     */
    @RequestMapping(value = "subOrders/third/findSubOrderThisMonthCountByStoreId/{storeId}", method = RequestMethod.GET, produces = "application/json; charset=utf-8")
    public String thirdFindSubOrderThisMonthCountByStoreId(@PathVariable String storeId);

    /**
     * 根据storeId查找累计消费金额
     *
     * @param storeId
     * @return
     */
    @RequestMapping(value = "subOrders/third/findSubOrderPayAmountByStoreId/{storeId}", method = RequestMethod.GET, produces = "application/json; charset=utf-8")
    public String thirdFindSubOrderPayAmountByStoreId(@PathVariable String storeId);

    /**
     * 根据agentId和createdAt查找总订单
     *
     * @param agentId
     * @param createdAt
     * @param page
     * @param size
     * @return
     */
    @RequestMapping(value = "subOrders/third/findSubOrdersByAgentIdAndCreatedAt/{agentId}/{createdAt}/{page}/{size}", method = RequestMethod.GET, produces = "application/json; charset=utf-8")
    public String thirdFindSubOrdersByAgentIdAndCreatedAt(@PathVariable String agentId, @PathVariable String createdAt, @PathVariable int page, @PathVariable int size);


    /**
     * 增加结算总表
     *
     * @param settlement
     * @return
     */
    @PostMapping(value = "settlement/third/addSettlement", produces = "application/json; charset=utf-8")
    public void thirdAddSettlement(@RequestBody String settlement);

    /**
     * 更改settlement表的status状态
     *
     * @param status
     * @param agentId
     * @param settlementDate
     */
    @PutMapping(value = "settlement/third/updateSettlementStatus/{status}/{agentId}/{settlementDate}", produces = "application/json; charset=utf-8")
    public void thirdUpdateSettlementStatus(@PathVariable String status, @PathVariable String agentId, @PathVariable String settlementDate);

    /**
     * 增加结算明细
     *
     * @param settlementDetails
     * @return
     */
    @PostMapping(value = "settlementDetails/third/addSettlementDetails", produces = "application/json; charset=utf-8")
    public void thirdAddSettlementDetails(@RequestBody String settlementDetails);


    /**
     * 增加采购付款凭证
     *
     * @param confirmation
     * @return
     */
    @RequestMapping(value = "confirmation/third/addConfirmation", method = RequestMethod.POST, produces = "application/json; charset=utf-8")
    public String thirdAddConfirmation(@RequestBody String confirmation);

    /**
     * 修改
     *
     * @param confirmation
     */
    @RequestMapping(value = "confirmation/third/updateConfirmation", method = RequestMethod.PUT, produces = "application/json; charset=utf-8")
    public void thirdUpdateConfirmation(@RequestBody String confirmation);

    /**
     * 根据ID查询采购付款凭证
     *
     * @param id ID
     * @return
     */
    @RequestMapping(value = "confirmation/third/findConfirmationById/{id}", method = RequestMethod.GET, produces = "application/json; charset=utf-8")
    public String thirdFindConfirmationById(@PathVariable String id);

    /**
     * 根据agentId查询采购付款凭证列表
     *
     * @param agentId
     * @param page
     * @param size
     * @return
     */
    @RequestMapping(value = "confirmation/third/findConfirmationsByAgentIdOrderByCreatedAt/{agentId}/{page}/{size}", method = RequestMethod.GET, produces = "application/json; charset=utf-8")
    public String thirdFindConfirmationsByAgentIdOrderByCreatedAt(@PathVariable String agentId, @PathVariable int page, @PathVariable int size);

    /**
     * 分页+多条件查询
     *
     * @param searchMap 查询条件封装
     * @param page      页码
     * @param size      页大小
     * @return 分页结果
     */
    @RequestMapping(value = "confirmation/third/findConfirmationsBySearch/{page}/{size}", method = RequestMethod.POST, produces = "application/json; charset=utf-8")
    public String thirdFindConfirmationsBySearch(@RequestBody Map searchMap, @PathVariable int page, @PathVariable int size);


    /**
     * 增加采购单
     *
     * @param purchase
     */
    @RequestMapping(value = "purchase/third/addPurchase", method = RequestMethod.POST, produces = "application/json; charset=utf-8")
    public void thirdAddPurchase(@RequestBody String purchase);

    /**
     * 分页+多条件查询采购单
     *
     * @param searchMap 查询条件封装
     * @param page      页码
     * @param size      页大小
     * @return 分页结果
     */
    @RequestMapping(value = "purchase/third/findPurchasesBySearch/{page}/{size}", method = RequestMethod.POST, produces = "application/json; charset=utf-8")
    public String thirdFindPurchasesBySearch(@RequestBody Map searchMap, @PathVariable int page, @PathVariable int size);

    /**
     * 根据storeId查找剩余余额
     *
     * @param storeId
     * @return
     */
    @RequestMapping(value = "purchase/third/findPurchaseBalanceByStoreId/{storeId}", method = RequestMethod.GET, produces = "application/json; charset=utf-8")
    public String thirdFindPurchaseBalanceByStoreId(@PathVariable String storeId);
}
